{extend name="index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    <input type="hidden" name="goods_id" value="{$goods_id}">
    {volist name="data" id="vo"}
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color: red">商品规格</span>  {$vo.suk}</label>
        <div class="layui-input-block">
            <input type="text"  value="{$vo.price}" lay-verify="required|number" autocomplete="off" placeholder=""
                   class="layui-input">
        </div>
        <label class="layui-form-label">最低价格</label>
        <div class="layui-input-block">
            <input type="number"  name="suk[{$vo.id}][min_price]"
                   data-min="0.01"
                   step="0.01"
                   value="{$vo.min_price}"
                   lay-verify="required|number|minDecimal"
                   autocomplete="off"
                   placeholder="最低金额"
                   class="layui-input">
        </div>
    </div>
    {/volist}

    <div class="layui-form-item">
        <label class="layui-form-label">砍价人数</label>
        <div class="layui-input-block">
            <input type="text" name="bargain_count" value="{$goods_info.bargain_count}"  lay-verify="required|number" autocomplete="off"
                   placeholder="砍价人数"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">砍价时间(分钟)</label>
        <div class="layui-input-block">
            <input type="text" name="bargain_time" value="{$goods_info.bargain_time}"  lay-verify="required|number" autocomplete="off"
                   placeholder="砍价时间"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">砍价金额</label>
        <div class="layui-input-block">

            <input type="radio" name="sj_kan" value="1"  title="随机金额"  {eq name="goods_info.sj_kan" value="1" }checked{/eq}>

            <input type="radio" name="sj_kan" value="2" title="固定金额"  {eq name="goods_info.sj_kan" value="2" }checked{/eq}>
        </div>
        <p style="color: #c0ccda">需设置帮砍人数，每人砍价金额相同，达到该人数才可砍至底价<p>
    </div>


    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['form','yznForm'], function () {
        var yznForm = layui.yznForm;
        var form = layui.form;
        yznForm.bindevent($("form.layui-form"));

        form.verify({
            minDecimal: function(value, item){
                var min = parseFloat(item.getAttribute('data-min')) || 0.01;
                if(parseFloat(value) < min){
                    return '输入值不能小于 ' + min;
                }
            }
        });

    });
</script>
{/block}